import React, { Component } from "react"
import Headcom from "../../components/header"
import "./index.css"


class Index extends Component {
	constructor(props) {
		super(props);
		this.state = {
			navlist: [
				{ path: "/mycollection", title: "我的收藏" },
				{ path: "/address", title: "收货地址" },
				{ path: "/coupon", title: "我的优惠券" },
				{ path: "/pushinghands", title: "跨夫特推手" }
			],
			roderlist: [
				{ path: "/waitpay", title: "待付款" },
				{ path: "/waitsend", title: "待发货" },
				{ path: "/waitrevice", title: "待收货" },
				{ path: "/comptelete", title: "已完成" }
			]
		}
	}


	navigator(url){
        if(!localStorage.getItem("userinfo")){
			this.props.history.push("/login")
		}else{
			this.props.history.push(url)
		}
	}


	render() {
		return (
			<div className="my">
				<Headcom title="我的" />
				<div className="userinfo">
					<img src="" alt="" />
					<div>
						<p>future</p>
						<p>余额：<span>0.00</span>金豆：<span>50</span></p>
					</div>
					<em>签到</em>
				</div>
				<div className="order">
					<div className="hd">
						<span className="fl">我的订单</span>
						<span className="fr more">查看全部订单<i></i></span>
					</div>
					<div className="nav">
						{this.state.roderlist.map(item => {
							return <span key={item.path} onClick={this.navigator.bind(this,item.path)}><i></i>{item.title}</span>
						})}
                    </div>
				</div>
				<ul>
					{this.state.navlist.map(item => {
						return <li key={item.path} onClick={this.navigator.bind(this,item.path)}>
							<span></span>
							{item.title}
							<i></i>
						</li>
					})}
				</ul>
			</div>
		)
	}
}

export default Index